package com.yangmf.auto_message_handle.mapper;

import com.yangmf.auto_message_handle.pojo.dto.MesgDTO;
import com.yangmf.auto_message_handle.pojo.entity.Mesg;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface DataMapper {

    /**
     * 添加图片url
     *
     */

    public void insert(Mesg mesg);

    @Select("select * from message where event_id=#{EventId} and message_type=#{type}")
    public List<Mesg> getmessage(Long EventId,Integer type);

    @Select("select * from message where message_type=1")
    List<Mesg> getmessagebyType();

    @Select("select * from message where message_type=1 and event_type=#{eventType}")
    List<Mesg> getFilebyEventType(Long eventType);

    void batchdeleteMessagesByEventId(List<Long> ids);


    @Update("update message set event_id=#{eventId2} where event_id=#{eventId1}")
    void updateEventId(Long eventId1, Long eventId2);



    void updateEventIdById(List messageIds,Long eventId);

    List<Mesg> listofMessage(Mesg mesg);


    void batchdeleteMessagesById(List<Long> messageIds);

    @Update("update message set event_type= #{archiveId} where event_id= #{eventId}")
    void updateEventTypeByEventType(Long eventId, Long archiveId);


    List<Mesg> selectFilesByEventId(List<Long> ids);

    List<Mesg> selectFilesByMessageId(List<Long> messageIds);
}
